package cn.itcast.dao;

import cn.itcast.bean.Student;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class WriteDemo {
    public ArrayList<Student> getList() throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("d:\\student.txt"));
        ArrayList<Student> list = new ArrayList<>();
        String s;
        while ((s = br.readLine())!= null){
            String[] split = s.split(",");
            Student stu = new Student(split[0],Integer.parseInt(split[1]),Integer.parseInt(split[2]));
            list.add(stu);

        }
        br.close();
        return list;
    }
}
